package com.aaa.controller;

import com.aaa.dto.CarDto;
import com.aaa.pojo.DefaultMsg;
import com.aaa.service.CarService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/car")
public class CarController {
    @Resource
    private CarService carService;


    @RequestMapping("/listAllById")
    public List<CarDto> listAllById(Integer userId) {
        return carService.listAllById(userId);
    }


    @RequestMapping("/CarInsert")
    public DefaultMsg CarInsert(Integer userId, Integer goodsId, Integer buyCount) {
        return carService.carInsert(userId, goodsId, buyCount);
    }

    @RequestMapping("/deleteCarByCarId")
    public DefaultMsg deleteCarByCarId(Integer carId) {
        return carService.deleteCarByCarId(carId);
    }

    @RequestMapping("/updateCountByGoodsId")
    public DefaultMsg updateCountByGoodsId(Integer goodsId, Integer buyCount) {
        return carService.updateCountByGoodsId(goodsId,buyCount);
    }
}
